package com.itheima.springbootwebbtalis.service.Impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.itheima.springbootwebbtalis.mapper.OperateLogMapper;
import com.itheima.springbootwebbtalis.pojo.LogQueryParam;
import com.itheima.springbootwebbtalis.pojo.OperateLog;
import com.itheima.springbootwebbtalis.pojo.PageResult;
import com.itheima.springbootwebbtalis.service.LogService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class LogServiceImpl implements LogService {
    @Autowired
    private OperateLogMapper  logMapper;

    @Override
    public PageResult page(LogQueryParam param) {
        PageHelper.startPage(param.getPage(),param.getPageSize());
        Page<OperateLog> p =logMapper.page(param);
        return new PageResult(p.getTotal(),p.getResult());
    }
}
